Skip to main content
Glama
hyperspell

hyperspell-mcp

Official
by hyperspell

List Collections

Retrieve all available collections from Hyperspell to connect AI applications with unstructured and semi-structured data sources.

Instructions

Get a list of all collections on Hyperspell

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'List Collections' tool. Registers the tool/resource and implements the logic to fetch and return the list of collections using the Hyperspell API.
    @mcp.tool_or_resource("collection://", name="List Collections") def list_collections() -> list[Collection]: """Get a list of all collections on Hyperspell""" r = mcp.api.collections.list() return Collection.from_pydantic(r.items)
  • Dataclass schema for Collection objects returned by the tool.
    class Collection(BaseModel): name: str documents_count: int = 0
  • Decorator that registers the 'List Collections' tool or resource based on server configuration.
    @mcp.tool_or_resource("collection://", name="List Collections")
  • BaseModel class providing from_pydantic method used to convert API responses to dataclasses in the handler.
    @dataclass class BaseModel: @overload @classmethod def from_pydantic(cls, model: PydanticBaseModel) -> Self: ... @overload @classmethod def from_pydantic(cls, model: Sequence[PydanticBaseModel]) -> list[Self]: ... @classmethod def from_pydantic( cls, model: PydanticBaseModel | Sequence[PydanticBaseModel] ) -> Self | list[Self]: """Convert a Pydantic model to a data class, selecting only the keys that are part of the data class.""" if isinstance(model, Sequence): return [cls.from_pydantic(m) for m in model] data = model.model_dump() # Only select the keys in data that are part of this data class data = {key: value for key, value in data.items() if key in cls.__annotations__} return cls(**data)
  • Decorator factory method that conditionally registers functions as MCP tools or resources.
    def tool_or_resource(self, uri: str, name: str | None = None): def decorator(fn: Callable): description = fn.__doc__ if self.config.use_resources: self.resource( uri, name=name, description=description, mime_type="application/json", )(fn) if self.config.use_tools: self.add_tool(fn, name=name, description=description) return fn return decorator

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hyperspell/hyperspell-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server